pp108 : Using Problem Registry

Using Problem Registry

This topic presents an overview of using Problem Registry.


To use the Problem Registry framework, the application developer of a component (application connector) must ensure that:

  • every such component has the capacity to detect a problem, and register and un-register from the bus framework.
  • the detection of the problem is handled during the initialization or creation of a request (for example, the open() Web service operation in application connector), as well as while processing a request.

Sample code for Registering a problem

IProblemDefinition someProblem = managedComponent.defineProblem()


IProblemDefinition : Developers use the handle to this interface to register a defined potential problem. These problems are defined and may be encountered during runtime, and hence must be registered and raised for a quick resolution. This interface contains methods to raise the problem. Subsequently, the problem must be raised.

Sample code for Raising the problem

someProblem.raiseProblem()


IProblemResolver : After a problem has been registered and raised it must be resolved. Therefore, the problem resolver is passed on by the component that raised the problem (the problem resolver may be passed as a parameter in the raiseProblem() Web service operation. This interface must be implemented by the developer. It contains the logic for problem resolution based on the problem raised. The resolveproblem() Web service operation is invoked periodically by the system to request a resolution to the problem, until the status of the problem is changed to 'resolved'. Therefore, the implementation of this interface must call one of the methods on the problem status event listener to indicate the status of the problem. For example, the notifyResolved() Web service operation is invoked on IProblemEventStatusListener if the problem is resolved.

Sample code for Implementing the problem resolution

 /* Contains the logic for resolution of the Problem. This is a dummy implementation for 
Problem resolution .*/
class MyProblemResolver implements IProblemResolver
{
private final long m_resolveDuration;
private final long m_startedAt;
/**
* clears the problem after the specified interval
* @param resolveDuration
*/
MyProblemResolver( long resolveDuration)
{
m_resolveDuration = resolveDuration;
m_startedAt = System.currentTimeMillis();
}
public void resolveProblem(IProblemStatusEventListenerproblemStatusEventListener)
{
if( ( System.currentTimeMillis() - m_startedAt ) >m_resolveDuration )
{
/* A Problem is not resolved until the notifyResolved Web service operation is invoked on the IProblemStatusEventListener object */
problemStatusEventListener.notifyResolved();
}
else
{
/* Indicate to the framework the time interval after which we need to check for resolution the next time */	               
problemStatusEventListener.notifyNotResolved(30000);
}
}
}								


IProblemStatusEventListener : This interface is provided as a handler to users to update the status of the problem. It contains the notifyNotResolved() Web service operation to help users communicate that the problem has not been resolved yet and to provide a time interval after which the problem resolution can be provided. The notifyResolved() Web service operation indicates that the problem has been resolved.